#! /usr/bin/env python
# -*- coding: utf-8 -*-

#INSERT INTO [digitwhu].[dbo].[street]
#           ([name]
#           ,[district_id])
#     VALUES
#           (<name, nvarchar(50),>
#           ,<district_id, int,>)
#GO

header = """
INSERT INTO [digitwhu].[dbo].[street]
           ([name]
           ,[district_id])
     VALUES
"""

body = ''
f = open('street_info')
content = f.read()
for line in content.split('\n'):
	parts = line.split(' ')
	#文件结尾
	if( len(parts) == 1):
		continue
	street_id , name = line.split(' ')
	body += "('{0}',NULL),".format(name)

#删除结尾逗号
body = body[0:-1]


footer = """
GO
"""

print header + body + footer
